#include "net.h"

int main()
{
	//创建两管道
	int pipe1[2];
	int pipe2[2];

	pid_t chil = -1;
	
	if( (chil = fork()) < 0)
	{
		perror("fork");
		exit(0);
	}
	if(chil == 0)	//子进程
	{
		close(pipe1[0]);
		close(pipe2[1]);
		client(pipe2[0], pipe1[1]);
		exit(0);
	}else
	{
		close(pipe1[1]);
		close(pipe2[0]);
		server(pipe1[0], pipe2[1]);	
		waitpid(chil, NULL, 0);			//处理子进程问题。
		exit(0);
	}
	return 0;
}
